package cn.liccshop.core.backstage.sysSysMenu.service;

import cn.liccshop.core.entity.SysSysMenu;
import cn.liccshop.core.backstage.sysSysMenu.mapper.SysSysMenuMapper;
import cn.liccshop.core.backstage.sysSysMenu.service.ISysSysMenuService;
import cn.liccshop.core.utils.SysSysMenuUtils;
import cn.liccshop.sys.constants.Constants;
import cn.liccshop.sys.exception.MySystemException;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 菜单表 服务实现类
 * </p>
 *
 * @author LiCC
 * @since 2019-04-05
 */
@Service
public class SysSysMenuServiceImpl extends ServiceImpl<SysSysMenuMapper, SysSysMenu> implements ISysSysMenuService {

    @Override
    public List<SysSysMenu> getList(SysSysMenu sysSysMenu) throws MySystemException {
        if (sysSysMenu.getIsShow() != 0 && sysSysMenu.getIsShow() != 1){
            throw new MySystemException("参数非法", Constants.INVALID_PARM);
        }
        List<SysSysMenu> menus = this.getBaseMapper().selectListByTypeAndSortASC(sysSysMenu.getIsShow());
        return SysSysMenuUtils.sysMenuListIntegration(menus);
    }
}
